// cookies.js

const getCookie = (key) => {
  // 从浏览器的 Cookie 中获取指定 key 的值
  const cookies = uni.getStorageSync('cookies') || {};
  return cookies[key] || null;
};

const setCookie = (key, value) => {
  // 设置浏览器的 Cookie
  let cookies = uni.getStorageSync('cookies') || {};
  cookies[key] = value;
  uni.setStorageSync('cookies', cookies);
};

const removeCookie = (key) => {
  // 删除浏览器的 Cookie
  let cookies = uni.getStorageSync('cookies') || {};
  delete cookies[key];
  uni.setStorageSync('cookies', cookies);
};

export default {
  get: getCookie,
  set: setCookie,
  remove: removeCookie
};